<!-- $Id -->
{include file="pageheader.htm"}
<form name="theForm" method="get" action="order.php" onsubmit="return check()">
    <div class="list-div">
        <table>
            <tr>
                <th width="120">{$lang.label_action_note}</th>
                <td><textarea name="action_note" cols="60" rows="3">{$action_note}</textarea>
                    {if $require_note}{$lang.require_field}{/if}</td>
            </tr>
            {if $show_refund}
            <tr>
                <th>{$lang.label_refund_amount}</th>
                <td><p>
                    {$lang.amount} <input type="text" size="15" value= {$refund}  name="back_amount">
                    {$lang.freight} <input type="text" size="15" value={$shipping} name="back_shipping">
                    <input type="hidden" value="{$shipping}" name="get_ship">
                    <label><input type="radio" name="is_shipping" value="1" onclick="get_ship_one(this)" checked/>{$lang.return_shipping}</label>
                    <label><input type="radio" name="is_shipping" value="2" onclick="get_ship_two(this)"/>{$lang.no_return_shipping}</label>
                </p></td>
            </tr>
            <tr>
                <th>{$lang.label_handle_refund}</th>
                <td>
                    <p>
                    {if !$anonymous}
                    <label><input type="radio" name="refund" value="1" checked/>{$lang.return_user_money}</label>
                    {/if}
                    <label><input type="radio" name="refund" value="2" />{$lang.return_offline}</label>
                    </p>
                </td>
            </tr>
            <tr>
                <th>{$lang.label_refund_note}</th>
                <td><textarea name="refund_note" cols="60" rows="3" id="refund_note">{$refund_note}</textarea></td>
            </tr>
            {/if}
            <tr>
                <td colspan="2">
                    <div align="center">
                        <input type="submit" name="submit" value="{$lang.button_submit}" class="button" />
                        <input type="button" name="back" value="{$lang.back}" class="button" onclick="history.back()" />
                        <input type="hidden" name="order_id" value="{$order_id}" />
                        <input type="hidden" name="operation" value="{$operation}" />
                        {if $back_id}
                        <input type="hidden" name="back_id" value="{$back_id}" />
                        {/if}
                        <input type="hidden" name="act" value="back_operate_post" />
                    </div></td>
            </tr>
        </table>
    </div>
</form>
<script language="JavaScript">
    var require_note = '{$require_note}';
    var show_refund  = '{$show_refund}';
    var show_cancel = '{$show_cancel_note}';
    {literal}

    function check()
    {
        if (require_note && document.forms['theForm'].elements['action_note'].value == '')
        {
            alert(pls_input_note);
            return false;
        }
        if (show_cancel && document.forms['theForm'].elements['cancel_note'].value == '')
        {
            alert(pls_input_cancel);
            return false;
        }
        if (show_refund)
        {
            var selected = false;
            for (var i = 0; i < document.forms['theForm'].elements.length; i++)
            {
                ele = document.forms['theForm'].elements[i];
                if (ele.tagName == 'INPUT' && ele.name == 'refund' && ele.checked)
                {
                    selected = true;
                    break;
                }
            }
            if (!selected)
            {
                alert(pls_select_refund);
                return false;
            }
            if(document.forms['theForm'].elements['is_shipping'].value == '')
            {
                alert(pls_select_shipping);
                return false;
            }




        }
        return true;
    }

    function get_ship_one(a){
        var get_ship = document.getElementsByName('get_ship')[0];
        var obj = document.getElementsByName('back_shipping')[0];
        obj.value = get_ship.value;
    }
    function get_ship_two(a){
        var get_ship = document.getElementsByName('get_ship')[0];
        var obj = document.getElementsByName('back_shipping')[0];
        obj.value = 0.00;
    }
    {/literal}

</script>
{include file="pagefooter.htm"}